package com.rest.demo.nio;

import java.io.*;
import java.nio.channels.FileChannel;

/**
 * @author Administrator
 * @decription
 * @Date 2018-02-07 17:23
 */
public class FileChannelDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream input = new FileInputStream("F:\\a.txt");
        FileChannel fromChannel = input.getChannel();

        FileOutputStream output = new FileOutputStream("F:\\b.txt");
        FileChannel toChannel = output.getChannel();

        int position = 0;
        long count  = fromChannel.size();
        fromChannel.transferTo(position,count,toChannel);
    }
}
